<?php
declare (strict_types = 1);

namespace app\common\model;

use think\Model;
use think\response\Json;
use think\model\relation\HasOne;

/**
 * @mixin \think\Model
 */
class PrizeRecord extends Base
{

    protected $name = 'prize_record';

    public function user(): HasOne
    {
        return $this->hasOne(User::class, 'id', 'uid')->field('id,code,nickname,mobile');
    }

    public function getProductInfoAttr($value)
    {
        return $value ? json_decode($value, true) : [];
    }
}
